package model.skill;

import model.effect.ConstantChangeStatEffect;
import model.effect.Effect;
import model.entity.Entity;
import model.entity.stats.Stat;
import model.entity.stats.StatType;

public class Enchantment extends ProjectileSkill{

	private Stat levelStat;
	
	public Enchantment()
	{
		super(SkillType.ENCHANTMENT, SkillType.ENCHANTMENT, 10, ProjectileLibrary.getInstance().getSelfProjectile("selfProjectileSleepEffect"), false);
		levelStat = new Stat(1, StatType.LEVEL);
	}
	
	public void activate(Entity entity)
	{
		int cost = super.getCost();
		if(entity.getStat(StatType.MP).getValue() > cost && !this.getInUse())
		{
			entity.getStats().addConstantModifier(StatType.MP, -cost);
			ProjectileInformation projectileInfo = new ProjectileInformation(entity.getLocation(), entity.getDirection());
			int newSleepValue = (int)levelStat.getValue();
			Effect newValue = new ConstantChangeStatEffect("SleepEffect", StatType.HP, (newSleepValue*10));
			this.getProjectile().setEffect(newValue);
			this.setInUse(true);
			this.getProjectile().propagate(projectileInfo);
		}
		else
			;
		this.setInUse(false);
	}
}
